<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="pinpin社保" />
	<meta name="description" content="pinpin社保" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>社保运营后台-用户设备和渠道管理</title>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
</head>
<body>
	<div id="wrapper">
		<%@ include file="/WEB-INF/jsp/common/menu.jsp" %>
        <div id="page-wrapper">
        	<div class="row">
                <div class="col-lg-12">
                    <!-- 路径导航 -->
                    <ol class="breadcrumb">
				      <li>社保后台</li>
				      <li class="active">用户设备和渠道管理</li>
				      <li><a href="${market_date_user_list_uri }">市场的日用户汇总</a></li>
				    </ol>
                </div>
            </div>
            <div class="row">
            	<div class="col-lg-12">
            		<div class="panel panel-default">
            			<div class="panel-body">
            			
            				<ul class="nav nav-tabs">
                                <li class="${userTab ? 'active' : '' }">
                                	<a href="#userTab" data-toggle="tab" onclick="javascript:tabSwitch(0)">用户</a>
                                </li>
                                <li class="${userFlagTab ? 'active' : '' }">
                                	<a href="#userFlagTab" data-toggle="tab" onclick="javascript:tabSwitch(1)">用户设备和渠道</a>
                                </li>
                            </ul>
                            <div class="tab-content">
                                <div class="tab-pane fade in active" id="#userTab">
		        			    	<div class="form-inline dt-bootstrap no-footer">
		        			    		<!-- 表单查询 -->
		        			    		<form action="${userFlag_manage_uri }" method="post" id="queryUserForm">
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    				<label class="checkbox-inline">
		                                        <select class="form-control" name="userType">
		                                            <option value="" selected="selected">游客+注册</option>
		                                            <option value="1" <c:if test="${queryForm.userType=='1' }">selected="selected"</c:if>>注册</option>
		                                            <option value="0" <c:if test="${queryForm.userType=='0' }">selected="selected"</c:if>>游客</option>
		                                        </select></label>
		        			    				<label class="checkbox-inline">
		                                        <select class="form-control" name="market">
		                                            <option value="" selected="selected">所有应用市场</option>
		                                            <c:forEach items="${marketList }" var="market">
		                                            	<option value="${market }" <c:if test="${queryForm.market==market }">selected="selected"</c:if>>${market }</option>
		                                            </c:forEach>
		                                        </select></label>
		        			    				<label class="checkbox-inline">生成时间：
		        			    					<input type="text" class="form-control" name="gen_start_time" placeholder="开始时间" value="${queryForm.gen_start_time }" onClick="WdatePicker()"><span>-&#12288;</span>
		        			    					<input type="text" class="form-control" name="gen_end_time" placeholder="结束时间" value="${queryForm.gen_end_time }" onClick="WdatePicker()"></label>
		        			    			    <input type="submit" class="btn btn-primary" id="queryBtn" value="查 询" />
		        			    			    <input type="button" class="btn btn-primary" id="resetBtn" value="重置" />
		        			    			</div>
		        			    		</div>
		        			    		</form>
		        			    		<hr />
		        			    		<!-- 分页 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-2">
		        			    				<button type="button" id="exportBtn" class="btn btn-primary btn-sm">批量导出</button>
		        			    			</div>
		        			    			<div class="col-lg-10">
		        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
		        			    					<jsp:param name="formId" value="queryUserForm"/>
		        			    				</jsp:include>
		        			    			</div>
		        			    		</div>
		        			    		<!-- 表格列表 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12 ">
		        			    				<table class="table tree table-striped table-bordered table-hover">
		        			    					<thead><tr>
		        			    						<th width="45px"><input type="checkbox" id="uids"></th>
		                                                <th>ID</th>
		                                                <th>用户</th>
		                                                <th>设备标识</th>
		                                                <th>应用市场</th>
		                                                <th>生成时间</th>
		                                                <th>最近时间</th>
		                                                <th>广告商</th>
		        			    					</tr></thead>
		        			    					<tbody>
		        			    					<c:choose>
		        			    						<c:when test="${empty pageModel.recordList }">没有找到相关记录啊</c:when>
		        			    						<c:otherwise>
															<c:forEach items="${pageModel.recordList }" var="user">
				        			    					<tr role="row">
				        			    							<td><input type="checkbox" id="uids_${user.id }"></td>
				                                                    <td>${user.id }</td>
				                                                    <td>${user.userId } </td>
				                                                    <td>${user.deviceId }</td>
				                                                    <td>${user.appMarket}</td>
				                                                    <td>${user.gen_time }</td>
				                                                    <td>${user.update_time }</td>
				                                                    <td>${user.advertiser }</td>
				        			    						</tr>
				        			    					</c:forEach>
		        			    						</c:otherwise>
		        			    					</c:choose>
		        			    					</tbody>
		        			    				</table>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 分页 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-2">
		        			    			</div>
		        			    			<div class="col-lg-10">
		        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
		        			    					<jsp:param name="formId" value="queryUserForm"/>
		        			    				</jsp:include>
		        			    			</div>
		        			    		</div>
		        			    	</div>
        			    		</div> <!-- tab-pane -->
        			    	</div>
            			</div>
            		</div>
            	</div>
            </div>
        </div>
	</div>
	<script language="javascript">
	$(function(){
		//重置
		$("#resetBtn").click(function(){
			$("#queryUserForm").find("input[type='text'],input[type='select']").val("");
		});
		//导出用户列表
		$("#exportBtn").click(function(){
			var f = $("#queryUserForm");
			f.attr("action", "${export_excel_uri}");
			f.submit();
			f.attr("action", "${userFlag_manager_uri}");
		});
	});
	
	function tabSwitch(index) {
		notice("正在处理……", 2);
		if (index == 0) {
			document.location.href="${user_manage_uri}";
		} else {
			document.location.href="${userFlag_manage_uri}";
		}
	}
 	</script>
</body>
</html>